package com.order.controller.sys;


import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import com.jfinal.ext.route.ControllerBind;
import com.order.config.Consts;
import com.order.controller.BaseController;
import com.order.model.sys.SysMenu;
import com.order.model.sys.SysModule;
import com.order.shiro.ShiroUtils;

@ControllerBind(controllerKey = "/sys")
public class IndexController extends BaseController {
	
	public void index() {		
		setAttr("parent_menu", SysModule.dao.getModule(ShiroUtils.getUserId()));
		setAttr("children_menu", SysMenu.dao.getMenuByUserId(ShiroUtils.getUserId()));
		render(Consts.SYS + "index.htm");
	}
	
	public void password(){
		render(Consts.SYS + "password.htm");
	}
	
	public void logout(){
		System.out.println(Consts.SYS + "");
		Subject user = SecurityUtils.getSubject();
		user.logout();
		redirect(Consts.COMMON);
	}
	
}
